;
var account_index_ops = {
    init:function () {
        this.bindEvent();
    },
    bindEvent:function () {
        var that = this;
        $('.search').click(function () {
            $('.wrap_search').submit();
        });

        $(".remove").click(function () {
            // if( !confirm( "您确认删除么？" ) ){
            //     return;
            // }
            that.ops( "remove",$(this).attr("data") );
        });

        $(".recover").click(function () {
            // if( !confirm( "您确认回复么？？" ) ){
            //     return;
            // }
            that.ops( "recover",$(this).attr("data") );
        });

    },

    ops:function( act,uid ){
        callback = {
            "ok":function(){
                $.ajax({
                    url: common_ops.buildWebUrl("/account/ops"),
                    type: "POST",
                    data:{
                        act:act,
                        uid:uid,
                    },
                    dataType:"json",
                    success:function ( res ) {
                        callback = null;
                        if( res.code == 200 ){
                            callback = function(){
                                window.location.href = window.location.href;
                            }
                            common_ops.alert( res.msg ,callback);
                        }
                    }

                });
            },
            "cancel":function(){

            }
        };
        common_ops.confirm( (act == "remove") ? "您确定删除么？" : "您确定恢复么？",callback );

    }
}


$(document).ready(function(){
    account_index_ops.init();
});